package com.eos.control.action.activity;

import com.eos.business.service.SysActivityBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysCombo;
import com.eos.orm.mybatis.model.SysUser;

public class SaveSetMealAction extends AbstractBaseAction {
	private static final long serialVersionUID = 1911927788682319056L;
	private String comboName;
	private String comboPrice;
	private String comboDesc;

	public void setComboName(String comboName) {
		this.comboName = comboName;
	}

	public void setComboPrice(String comboPrice) {
		this.comboPrice = comboPrice;
	}

	public void setComboDesc(String comboDesc) {
		this.comboDesc = comboDesc;
	}

	@Override
	public String execute() {
		try {
			String strTime = ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss");
			SysUser user = (SysUser) getSession().getAttribute("SysUser");
			String userId = String.valueOf(user.getId());
			SysCombo combo = new SysCombo();
			combo.setComboDesc(comboDesc);
			combo.setComboName(comboName);
			combo.setComboPrice(comboPrice);
			combo.setDealFlag(ConstantTool.DEAL_FALG_OK);
			combo.setStatus(ConstantTool.STATUS_OK);
			combo.setInsertTime(strTime);
			combo.setInsertUserId(userId);
			combo.setUpdateUserId(userId);
			combo.setModifyTime(strTime);
			SysActivityBusinessService sabs = new SysActivityBusinessService();
			String exeStatus = sabs.saveSysCombo(combo);
			if("SUCCESS".equals(exeStatus)){
				statusCode = "200";
				message = "新增套餐信息成功!";
			}else{
				statusCode = "300";
				message = "系统繁忙, 新增套餐信息失败!";
			}
		} catch (Exception e) {
			e.printStackTrace();
			statusCode = "300";
			message = "系统异常, 新增套餐信息失败!";
		}
		return SUCCESS;
	}
}
